<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once '../config.php';
require_once 'Msg.php';

$m = new Lib\Msg( $db, 'bbq' );

$nick = htmlspecialchars($_POST['nick']);
$email = htmlspecialchars($_POST['email']);
$txt = htmlspecialchars($_POST['context']);

$time = time();
$ip = null;

$res = $m->AddMsg($nick, $time, $txt, $ip, $email, 'f', 'f' );
if ( $res ) {
    $r['err'] = 0;
    echo json_encode($r);
}else {
    $r['err'] = 1;
    echo json_encode($r);
}